var current_arrg_page, current_arrg_rows;
var current_orders_page, current_orders_rows;
var selectedUserId;
function getTranslation(text) {
    if (typeof text == 'undefined') return '';
    if (!text) {
        return '';
    }
    translation = lang_vars[text.trim()];
    if ((translation == 'null' || !translation) && typeof(lang_vars[text]) != 'undefined') translation = text;
    if (arguments.length > 1) {
        args = typeof(arguments[1]) === 'object' ? arguments[1] : Array.prototype.slice.call(arguments, 1);
        translation = format(translation ? translation: text, args);
    }
    return translation ? translation: text;
}
function orderInfoClose() {
    $('#order_info').dialog('close');
}
function arrgeInfoClose() {
    $('#arrange_info').dialog('close');
}
function sureInfoClose() {
    $("#wizard_field_winap_text").val("");
    $('#show_sure').dialog('close');
}
//function refuseClose() {
//	$(".resfuse_reason").val("");
//	$("#newUploadrefuse").empty();
//    $('#show_cancel').dialog('close');
//}
jQuery.bt = {
    version: '0.9.5-rc1'
};; (function($) {
    jQuery.fn.bt = function(content, options) {
        if (typeof content != 'string') {
            var contentSelect = true;
            options = content;
            content = false;
        } else {
            var contentSelect = false;
        }
        if (jQuery.fn.hoverIntent && jQuery.bt.defaults.trigger == 'hover') {
            jQuery.bt.defaults.trigger = 'hoverIntent';
        }
        return this.each(function(index) {
            var opts = jQuery.extend(false, jQuery.bt.defaults, jQuery.bt.options, options);
            opts.spikeLength = numb(opts.spikeLength);
            opts.spikeGirth = numb(opts.spikeGirth);
            opts.overlap = numb(opts.overlap);
            var ajaxTimeout = false;
            if (opts.killTitle) {
                $(this).find('[title]').andSelf().each(function() {
                    if (!$(this).attr('bt-xTitle')) {
                        $(this).attr('bt-xTitle', $(this).attr('title')).attr('title', '');
                    }
                });
            }
            if (typeof opts.trigger == 'string') {
                opts.trigger = [opts.trigger];
            }//show_cancel
            if (opts.trigger[0] == 'hoverIntent') {
                var hoverOpts = jQuery.extend(opts.hoverIntentOpts, {
                    over: function() {
                        this.btOn();
                    },
                    out: function() {
                        this.btOff();
                    }
                });
                $(this).hoverIntent(hoverOpts);
            } else if (opts.trigger[0] == 'hover') {
                $(this).hover(function() {
                        this.btOn();
                    },
                    function() {
                        this.btOff();
                    });
            } else if (opts.trigger[0] == 'now') {
                if ($(this).hasClass('bt-active')) {
                    this.btOff();
                } else {
                    this.btOn();
                }
            } else if (opts.trigger[0] == 'none') {} else if (opts.trigger.length > 1 && opts.trigger[0] != opts.trigger[1]) {
                $(this).bind(opts.trigger[0],
                    function() {
                        this.btOn();
                    }).bind(opts.trigger[1],
                    function() {
                        this.btOff();
                    });
            } else {
                $(this).bind(opts.trigger[0],
                    function() {
                        if ($(this).hasClass('bt-active')) {
                            this.btOff();
                        } else {
                            this.btOn();
                        }
                    });
            }
            this.btOn = function() {
                if (typeof $(this).data('bt-box') == 'object') {
                    this.btOff();
                }
                opts.preBuild.apply(this);
                $(jQuery.bt.vars.closeWhenOpenStack).btOff();
                $(this).addClass('bt-active ' + opts.activeClass);
                if (contentSelect && opts.ajaxPath == null) {
                    if (opts.killTitle) {
                        $(this).attr('title', $(this).attr('bt-xTitle'));
                    }
                    content = $.isFunction(opts.contentSelector) ? opts.contentSelector.apply(this) : eval(opts.contentSelector);
                    if (opts.killTitle) {
                        $(this).attr('title', '');
                    }
                }
                if (opts.ajaxPath != null && content == false) {
                    if (typeof opts.ajaxPath == 'object') {
                        var url = eval(opts.ajaxPath[0]);
                        url += opts.ajaxPath[1] ? ' ' + opts.ajaxPath[1] : '';
                    } else {
                        var url = opts.ajaxPath;
                    }
                    var off = url.indexOf(" ");
                    if (off >= 0) {
                        var selector = url.slice(off, url.length);
                        url = url.slice(0, off);
                    }
                    var cacheData = opts.ajaxCache ? $(document.body).data('btCache-' + url.replace(/\./g, '')) : null;
                    if (typeof cacheData == 'string') {
                        content = selector ? $("<div/>").append(cacheData.replace(/<script(.|\s)*?\/script>/g, "")).find(selector) : cacheData;
                    } else {
                        var target = this;
                        var ajaxOpts = jQuery.extend(false, {
                                type: opts.ajaxType,
                                data: opts.ajaxData,
                                cache: opts.ajaxCache,
                                url: url,
                                complete: function(XMLHttpRequest, textStatus) {
                                    if (textStatus == 'success' || textStatus == 'notmodified') {
                                        if (opts.ajaxCache) {
                                            $(document.body).data('btCache-' + url.replace(/\./g, ''), XMLHttpRequest.responseText);
                                        }
                                        ajaxTimeout = false;
                                        content = selector ? $("<div/>").append(XMLHttpRequest.responseText.replace(/<script(.|\s)*?\/script>/g, "")).find(selector) : XMLHttpRequest.responseText;
                                    } else {
                                        if (textStatus == 'timeout') {
                                            ajaxTimeout = true;
                                        }
                                        content = opts.ajaxError.replace(/%error/g, XMLHttpRequest.statusText);
                                    }
                                    if ($(target).hasClass('bt-active')) {
                                        target.btOn();
                                    }
                                }
                            },
                            opts.ajaxOpts);
                        jQuery.ajax(ajaxOpts);
                        content = opts.ajaxLoading;
                    }
                }
                var shadowMarginX = 0;
                var shadowMarginY = 0;
                var shadowShiftX = 0;
                var shadowShiftY = 0;
                if (opts.shadow && !shadowSupport()) {
                    opts.shadow = false;
                    jQuery.extend(opts, opts.noShadowOpts);
                }
                if (opts.shadow) {
                    if (opts.shadowBlur > Math.abs(opts.shadowOffsetX)) {
                        shadowMarginX = opts.shadowBlur * 2;
                    } else {
                        shadowMarginX = opts.shadowBlur + Math.abs(opts.shadowOffsetX);
                    }
                    shadowShiftX = (opts.shadowBlur - opts.shadowOffsetX) > 0 ? opts.shadowBlur - opts.shadowOffsetX: 0;
                    if (opts.shadowBlur > Math.abs(opts.shadowOffsetY)) {
                        shadowMarginY = opts.shadowBlur * 2;
                    } else {
                        shadowMarginY = opts.shadowBlur + Math.abs(opts.shadowOffsetY);
                    }
                    shadowShiftY = (opts.shadowBlur - opts.shadowOffsetY) > 0 ? opts.shadowBlur - opts.shadowOffsetY: 0;
                }
                if (opts.offsetParent) {
                    var offsetParent = $(opts.offsetParent);
                    var offsetParentPos = offsetParent.offset();
                    var pos = $(this).offset();
                    var top = numb(pos.top) - numb(offsetParentPos.top) + numb($(this).css('margin-top')) - shadowShiftY;
                    var left = numb(pos.left) - numb(offsetParentPos.left) + numb($(this).css('margin-left')) - shadowShiftX;
                } else {
                    var offsetParent = ($(this).css('position') == 'absolute') ? $(this).parents().eq(0).offsetParent() : $(this).offsetParent();
                    var pos = $(this).btPosition();
                    var top = numb(pos.top) + numb($(this).css('margin-top')) - shadowShiftY;
                    var left = numb(pos.left) + numb($(this).css('margin-left')) - shadowShiftX;
                }
                var width = $(this).btOuterWidth();
                var height = $(this).outerHeight();
                if (typeof content == 'object') {
                    var original = content;
                    var clone = $(original).clone(true).show();
                    var origClones = $(original).data('bt-clones') || [];
                    origClones.push(clone);
                    $(original).data('bt-clones', origClones);
                    $(clone).data('bt-orig', original);
                    $(this).data('bt-content-orig', {
                        original: original,
                        clone: clone
                    });
                    content = clone;
                }
                if (typeof content == 'null' || content == '') {
                    return;
                }
                var $text = $('<div class="bt-content"></div>').append(content).css({
                    padding: opts.padding,
                    position: 'absolute',
                    width: (opts.shrinkToFit ? 'auto': opts.width),
                    zIndex: opts.textzIndex,
                    left: shadowShiftX,
                    top: shadowShiftY
                }).css(opts.cssStyles);
                var $box = $('<div class="bt-wrapper"></div>').append($text).addClass(opts.cssClass).css({
                    position: 'absolute',
                    width: opts.width,
                    zIndex: opts.wrapperzIndex,
                    visibility: 'hidden'
                }).appendTo(offsetParent);
                if (jQuery.fn.bgiframe) {
                    $text.bgiframe();
                    $box.bgiframe();
                }
                $(this).data('bt-box', $box);
                var scrollTop = numb($(document).scrollTop());
                var scrollLeft = numb($(document).scrollLeft());
                var docWidth = numb($(window).width());
                var docHeight = numb($(window).height());
                var winRight = scrollLeft + docWidth;
                var winBottom = scrollTop + docHeight;
                var space = new Object();
                var thisOffset = $(this).offset();
                space.top = thisOffset.top - scrollTop;
                space.bottom = docHeight - ((thisOffset + height) - scrollTop);
                space.left = thisOffset.left - scrollLeft;
                space.right = docWidth - ((thisOffset.left + width) - scrollLeft);
                var textOutHeight = numb($text.outerHeight());
                var textOutWidth = numb($text.btOuterWidth());
                if (opts.positions.constructor == String) {
                    opts.positions = opts.positions.replace(/ /, '').split(',');
                }
                if (opts.positions[0] == 'most') {
                    var position = 'top';
                    for (var pig in space) {
                        position = space[pig] > space[position] ? pig: position;
                    }
                } else {
                    for (var x in opts.positions) {
                        var position = opts.positions[x];
                        if ((position == 'left' || position == 'right') && space[position] > textOutWidth + opts.spikeLength) {
                            break;
                        } else if ((position == 'top' || position == 'bottom') && space[position] > textOutHeight + opts.spikeLength) {
                            break;
                        }
                    }
                }
                var horiz = left + ((width - textOutWidth) * .5);
                var vert = top + ((height - textOutHeight) * .5);
                var points = new Array();
                var textTop, textLeft, textRight, textBottom, textTopSpace, textBottomSpace, textLeftSpace, textRightSpace, crossPoint, textCenter, spikePoint;
                switch (position) {

                    case 'top':
                        $text.css('margin-bottom', opts.spikeLength + 'px');
                        $box.css({
                            top: (top - $text.outerHeight(true)) + opts.overlap,
                            left: horiz
                        });
                        textRightSpace = (winRight - opts.windowMargin) - ($text.offset().left + $text.btOuterWidth(true));
                        var xShift = shadowShiftX;
                        if (textRightSpace < 0) {
                            $box.css('left', (numb($box.css('left')) + textRightSpace) + 'px');
                            xShift -= textRightSpace;
                        }
                        textLeftSpace = ($text.offset().left + numb($text.css('margin-left'))) - (scrollLeft + opts.windowMargin);
                        if (textLeftSpace < 0) {
                            $box.css('left', (numb($box.css('left')) - textLeftSpace) + 'px');
                            xShift += textLeftSpace;
                        }
                        textTop = $text.btPosition().top + numb($text.css('margin-top'));
                        textLeft = $text.btPosition().left + numb($text.css('margin-left'));
                        textRight = textLeft + $text.btOuterWidth();
                        textBottom = textTop + $text.outerHeight();
                        textCenter = {
                            x: textLeft + ($text.btOuterWidth() * opts.centerPointX),
                            y: textTop + ($text.outerHeight() * opts.centerPointY)
                        };
                        points[points.length] = spikePoint = {
                            y: textBottom + opts.spikeLength,
                            x: ((textRight - textLeft) * .5) + xShift,
                            type: 'spike'
                        };
                        crossPoint = findIntersectX(spikePoint.x, spikePoint.y, textCenter.x, textCenter.y, textBottom);
                        crossPoint.x = crossPoint.x < textLeft + opts.spikeGirth / 2 + opts.cornerRadius ? textLeft + opts.spikeGirth / 2 + opts.cornerRadius: crossPoint.x;
                        crossPoint.x = crossPoint.x > (textRight - opts.spikeGirth / 2) - opts.cornerRadius ? (textRight - opts.spikeGirth / 2) - opts.CornerRadius: crossPoint.x;
                        points[points.length] = {
                            x: crossPoint.x - (opts.spikeGirth / 2),
                            y: textBottom,
                            type: 'join'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: textBottom,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: textTop,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: textTop,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: textBottom,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: crossPoint.x + (opts.spikeGirth / 2),
                            y: textBottom,
                            type: 'join'
                        };
                        points[points.length] = spikePoint;
                        break;
                    case 'left':
                        $text.css('margin-right', opts.spikeLength + 'px');
                        $box.css({
                            top: vert + 'px',
                            left: ((left - $text.btOuterWidth(true)) + opts.overlap) + 'px'
                        });
                        textBottomSpace = (winBottom - opts.windowMargin) - ($text.offset().top + $text.outerHeight(true));
                        var yShift = shadowShiftY;
                        if (textBottomSpace < 0) {
                            $box.css('top', (numb($box.css('top')) + textBottomSpace) + 'px');
                            yShift -= textBottomSpace;
                        }
                        textTopSpace = ($text.offset().top + numb($text.css('margin-top'))) - (scrollTop + opts.windowMargin);
                        if (textTopSpace < 0) {
                            $box.css('top', (numb($box.css('top')) - textTopSpace) + 'px');
                            yShift += textTopSpace;
                        }
                        textTop = $text.btPosition().top + numb($text.css('margin-top'));
                        textLeft = $text.btPosition().left + numb($text.css('margin-left'));
                        textRight = textLeft + $text.btOuterWidth();
                        textBottom = textTop + $text.outerHeight();
                        textCenter = {
                            x: textLeft + ($text.btOuterWidth() * opts.centerPointX),
                            y: textTop + ($text.outerHeight() * opts.centerPointY)
                        };
                        points[points.length] = spikePoint = {
                            x: textRight + opts.spikeLength,
                            y: ((textBottom - textTop) * .5) + yShift,
                            type: 'spike'
                        };
                        crossPoint = findIntersectY(spikePoint.x, spikePoint.y, textCenter.x, textCenter.y, textRight);
                        crossPoint.y = crossPoint.y < textTop + opts.spikeGirth / 2 + opts.cornerRadius ? textTop + opts.spikeGirth / 2 + opts.cornerRadius: crossPoint.y;
                        crossPoint.y = crossPoint.y > (textBottom - opts.spikeGirth / 2) - opts.cornerRadius ? (textBottom - opts.spikeGirth / 2) - opts.cornerRadius: crossPoint.y;
                        points[points.length] = {
                            x: textRight,
                            y: crossPoint.y + opts.spikeGirth / 2,
                            type: 'join'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: textBottom,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: textBottom,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: textTop,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: textTop,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: crossPoint.y - opts.spikeGirth / 2,
                            type: 'join'
                        };
                        points[points.length] = spikePoint;
                        break;
                    case 'bottom':
                        $text.css('margin-top', opts.spikeLength + 'px');
                        $box.css({
                            top: (top + height) - opts.overlap,
                            left: horiz
                        });
                        textRightSpace = (winRight - opts.windowMargin) - ($text.offset().left + $text.btOuterWidth(true));
                        var xShift = shadowShiftX;
                        if (textRightSpace < 0) {
                            $box.css('left', (numb($box.css('left')) + textRightSpace) + 'px');
                            xShift -= textRightSpace;
                        }
                        textLeftSpace = ($text.offset().left + numb($text.css('margin-left'))) - (scrollLeft + opts.windowMargin);
                        if (textLeftSpace < 0) {
                            $box.css('left', (numb($box.css('left')) - textLeftSpace) + 'px');
                            xShift += textLeftSpace;
                        }
                        textTop = $text.btPosition().top + numb($text.css('margin-top'));
                        textLeft = $text.btPosition().left + numb($text.css('margin-left'));
                        textRight = textLeft + $text.btOuterWidth();
                        textBottom = textTop + $text.outerHeight();
                        textCenter = {
                            x: textLeft + ($text.btOuterWidth() * opts.centerPointX),
                            y: textTop + ($text.outerHeight() * opts.centerPointY)
                        };
                        points[points.length] = spikePoint = {
                            x: ((textRight - textLeft) * .5) + xShift,
                            y: shadowShiftY,
                            type: 'spike'
                        };
                        crossPoint = findIntersectX(spikePoint.x, spikePoint.y, textCenter.x, textCenter.y, textTop);
                        crossPoint.x = crossPoint.x < textLeft + opts.spikeGirth / 2 + opts.cornerRadius ? textLeft + opts.spikeGirth / 2 + opts.cornerRadius: crossPoint.x;
                        crossPoint.x = crossPoint.x > (textRight - opts.spikeGirth / 2) - opts.cornerRadius ? (textRight - opts.spikeGirth / 2) - opts.cornerRadius: crossPoint.x;
                        points[points.length] = {
                            x: crossPoint.x + opts.spikeGirth / 2,
                            y: textTop,
                            type: 'join'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: textTop,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: textBottom,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: textBottom,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: textTop,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: crossPoint.x - (opts.spikeGirth / 2),
                            y: textTop,
                            type: 'join'
                        };
                        points[points.length] = spikePoint;
                        break;
                    case 'right':
                        $text.css('margin-left', (opts.spikeLength + 'px'));
                        $box.css({
                            top: vert + 'px',
                            left: ((left + width) - opts.overlap) + 'px'
                        });
                        textBottomSpace = (winBottom - opts.windowMargin) - ($text.offset().top + $text.outerHeight(true));
                        var yShift = shadowShiftY;
                        if (textBottomSpace < 0) {
                            $box.css('top', (numb($box.css('top')) + textBottomSpace) + 'px');
                            yShift -= textBottomSpace;
                        }
                        textTopSpace = ($text.offset().top + numb($text.css('margin-top'))) - (scrollTop + opts.windowMargin);
                        if (textTopSpace < 0) {
                            $box.css('top', (numb($box.css('top')) - textTopSpace) + 'px');
                            yShift += textTopSpace;
                        }
                        textTop = $text.btPosition().top + numb($text.css('margin-top'));
                        textLeft = $text.btPosition().left + numb($text.css('margin-left'));
                        textRight = textLeft + $text.btOuterWidth();
                        textBottom = textTop + $text.outerHeight();
                        textCenter = {
                            x: textLeft + ($text.btOuterWidth() * opts.centerPointX),
                            y: textTop + ($text.outerHeight() * opts.centerPointY)
                        };
                        points[points.length] = spikePoint = {
                            x: shadowShiftX,
                            y: ((textBottom - textTop) * .5) + yShift,
                            type: 'spike'
                        };
                        crossPoint = findIntersectY(spikePoint.x, spikePoint.y, textCenter.x, textCenter.y, textLeft);
                        crossPoint.y = crossPoint.y < textTop + opts.spikeGirth / 2 + opts.cornerRadius ? textTop + opts.spikeGirth / 2 + opts.cornerRadius: crossPoint.y;
                        crossPoint.y = crossPoint.y > (textBottom - opts.spikeGirth / 2) - opts.cornerRadius ? (textBottom - opts.spikeGirth / 2) - opts.cornerRadius: crossPoint.y;
                        points[points.length] = {
                            x: textLeft,
                            y: crossPoint.y - opts.spikeGirth / 2,
                            type: 'join'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: textTop,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: textTop,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textRight,
                            y: textBottom,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: textBottom,
                            type: 'corner'
                        };
                        points[points.length] = {
                            x: textLeft,
                            y: crossPoint.y + opts.spikeGirth / 2,
                            type: 'join'
                        };
                        points[points.length] = spikePoint;
                        break;
                }
                var canvas = document.createElement('canvas');
                $(canvas).attr('width', (numb($text.btOuterWidth(true)) + opts.strokeWidth * 2 + shadowMarginX)).attr('height', (numb($text.outerHeight(true)) + opts.strokeWidth * 2 + shadowMarginY)).appendTo($box).css({
                    position: 'absolute',
                    zIndex: opts.boxzIndex
                });
                if (typeof G_vmlCanvasManager != 'undefined') {
                    canvas = G_vmlCanvasManager.initElement(canvas);
                }
                if (opts.cornerRadius > 0) {
                    var newPoints = new Array();
                    var newPoint;
                    for (var i = 0; i < points.length; i++) {
                        if (points[i].type == 'corner') {
                            newPoint = betweenPoint(points[i], points[(i - 1) % points.length], opts.cornerRadius);
                            newPoint.type = 'arcStart';
                            newPoints[newPoints.length] = newPoint;
                            newPoints[newPoints.length] = points[i];
                            newPoint = betweenPoint(points[i], points[(i + 1) % points.length], opts.cornerRadius);
                            newPoint.type = 'arcEnd';
                            newPoints[newPoints.length] = newPoint;
                        } else {
                            newPoints[newPoints.length] = points[i];
                        }
                    }
                    points = newPoints;
                }
                var ctx = canvas.getContext("2d");
                if (opts.shadow && opts.shadowOverlap !== true) {
                    var shadowOverlap = numb(opts.shadowOverlap);
                    switch (position) {
                        case 'top':
                            if (opts.shadowOffsetX + opts.shadowBlur - shadowOverlap > 0) {
                                $box.css('top', (numb($box.css('top')) - (opts.shadowOffsetX + opts.shadowBlur - shadowOverlap)));
                            }
                            break;
                        case 'right':
                            if (shadowShiftX - shadowOverlap > 0) {
                                $box.css('left', (numb($box.css('left')) + shadowShiftX - shadowOverlap));
                            }
                            break;
                        case 'bottom':
                            if (shadowShiftY - shadowOverlap > 0) {
                                $box.css('top', (numb($box.css('top')) + shadowShiftY - shadowOverlap));
                            }
                            break;
                        case 'left':
                            if (opts.shadowOffsetY + opts.shadowBlur - shadowOverlap > 0) {
                                $box.css('left', (numb($box.css('left')) - (opts.shadowOffsetY + opts.shadowBlur - shadowOverlap)));
                            }
                            break;
                    }
                }
                drawIt.apply(ctx, [points], opts.strokeWidth);
                ctx.fillStyle = opts.fill;
                if (opts.shadow) {
                    ctx.shadowOffsetX = opts.shadowOffsetX;
                    ctx.shadowOffsetY = opts.shadowOffsetY;
                    ctx.shadowBlur = opts.shadowBlur;
                    ctx.shadowColor = opts.shadowColor;
                }
                ctx.closePath();
                ctx.fill();
                if (opts.strokeWidth > 0) {
                    ctx.shadowColor = 'rgba(0, 0, 0, 0)';
                    ctx.lineWidth = opts.strokeWidth;
                    ctx.strokeStyle = opts.strokeStyle;
                    ctx.beginPath();
                    drawIt.apply(ctx, [points], opts.strokeWidth);
                    ctx.closePath();
                    ctx.stroke();
                }
                opts.preShow.apply(this, [$box[0]]);
                $box.css({
                    display: 'none',
                    visibility: 'visible'
                });
                opts.showTip.apply(this, [$box[0]]);
                if (opts.overlay) {
                    var overlay = $('<div class="bt-overlay"></div>').css({
                        position: 'absolute',
                        backgroundColor: 'blue',
                        top: top,
                        left: left,
                        width: width,
                        height: height,
                        opacity: '.2'
                    }).appendTo(offsetParent);
                    $(this).data('overlay', overlay);
                }
                if ((opts.ajaxPath != null && opts.ajaxCache == false) || ajaxTimeout) {
                    content = false;
                }
                if (opts.clickAnywhereToClose) {
                    jQuery.bt.vars.clickAnywhereStack.push(this);
                    $(document).click(jQuery.bt.docClick);
                }
                if (opts.closeWhenOthersOpen) {
                    jQuery.bt.vars.closeWhenOpenStack.push(this);
                }
                opts.postShow.apply(this, [$box[0]]);
            };
            this.btOff = function() {
                var box = $(this).data('bt-box');
                opts.preHide.apply(this, [box]);
                var i = this;
                i.btCleanup = function() {
                    var box = $(i).data('bt-box');
                    var contentOrig = $(i).data('bt-content-orig');
                    var overlay = $(i).data('bt-overlay');
                    if (typeof box == 'object') {
                        $(box).remove();
                        $(i).removeData('bt-box');
                    }
                    if (typeof contentOrig == 'object') {
                        var clones = $(contentOrig.original).data('bt-clones');
                        $(contentOrig).data('bt-clones', arrayRemove(clones, contentOrig.clone));
                    }
                    if (typeof overlay == 'object') {
                        $(overlay).remove();
                        $(i).removeData('bt-overlay');
                    }
                    jQuery.bt.vars.clickAnywhereStack = arrayRemove(jQuery.bt.vars.clickAnywhereStack, i);
                    jQuery.bt.vars.closeWhenOpenStack = arrayRemove(jQuery.bt.vars.closeWhenOpenStack, i);
                    $(i).removeClass('bt-active ' + opts.activeClass);
                    opts.postHide.apply(i);
                }
                opts.hideTip.apply(this, [box, i.btCleanup]);
            };
            var refresh = this.btRefresh = function() {
                this.btOff();
                this.btOn();
            };
        });
        function drawIt(points, strokeWidth) {
            this.moveTo(points[0].x, points[0].y);
            for (i = 1; i < points.length; i++) {
                if (points[i - 1].type == 'arcStart') {
                    this.quadraticCurveTo(round5(points[i].x, strokeWidth), round5(points[i].y, strokeWidth), round5(points[(i + 1) % points.length].x, strokeWidth), round5(points[(i + 1) % points.length].y, strokeWidth));
                    i++;
                } else {
                    this.lineTo(round5(points[i].x, strokeWidth), round5(points[i].y, strokeWidth));
                }
            }
        };
        function round5(num, strokeWidth) {
            var ret;
            strokeWidth = numb(strokeWidth);
            if (strokeWidth % 2) {
                ret = num;
            } else {
                ret = Math.round(num - .5) + .5;
            }
            return ret;
        };
        function numb(num) {
            return parseInt(num) || 0;
        };
        function arrayRemove(arr, elem) {
            var x, newArr = new Array();
            for (x in arr) {
                if (arr[x] != elem) {
                    newArr.push(arr[x]);
                }
            }
            return newArr;
        };
        function canvasSupport() {
            var canvas_compatible = false;
            try {
                canvas_compatible = !!(document.createElement('canvas').getContext('2d'));
            } catch(e) {
                canvas_compatible = !!(document.createElement('canvas').getContext);
            }
            return canvas_compatible;
        }
        function shadowSupport() {
            try {
                var userAgent = navigator.userAgent.toLowerCase();
                if (/webkit/.test(userAgent)) {
                    return true;
                } else if (/gecko|mozilla/.test(userAgent) && parseFloat(userAgent.match(/firefox\/(\d+(?:\.\d+)+)/)[1]) >= 3.1) {
                    return true;
                }
            } catch(err) {}
            return false;
        }
        function betweenPoint(point1, point2, dist) {
            var y, x;
            if (point1.x == point2.x) {
                y = point1.y < point2.y ? point1.y + dist: point1.y - dist;
                return {
                    x: point1.x,
                    y: y
                };
            } else if (point1.y == point2.y) {
                x = point1.x < point2.x ? point1.x + dist: point1.x - dist;
                return {
                    x: x,
                    y: point1.y
                };
            }
        };
        function centerPoint(arcStart, corner, arcEnd) {
            var x = corner.x == arcStart.x ? arcEnd.x: arcStart.x;
            var y = corner.y == arcStart.y ? arcEnd.y: arcStart.y;
            var startAngle, endAngle;
            if (arcStart.x < arcEnd.x) {
                if (arcStart.y > arcEnd.y) {
                    startAngle = (Math.PI / 180) * 180;
                    endAngle = (Math.PI / 180) * 90;
                } else {
                    startAngle = (Math.PI / 180) * 90;
                    endAngle = 0;
                }
            } else {
                if (arcStart.y > arcEnd.y) {
                    startAngle = (Math.PI / 180) * 270;
                    endAngle = (Math.PI / 180) * 180;
                } else {
                    startAngle = 0;
                    endAngle = (Math.PI / 180) * 270;
                }
            }
            return {
                x: x,
                y: y,
                type: 'center',
                startAngle: startAngle,
                endAngle: endAngle
            };
        };
        function findIntersect(r1x1, r1y1, r1x2, r1y2, r2x1, r2y1, r2x2, r2y2) {
            if (r2x1 == r2x2) {
                return findIntersectY(r1x1, r1y1, r1x2, r1y2, r2x1);
            }
            if (r2y1 == r2y2) {
                return findIntersectX(r1x1, r1y1, r1x2, r1y2, r2y1);
            }
            var r1m = (r1y1 - r1y2) / (r1x1 - r1x2);
            var r1b = r1y1 - (r1m * r1x1);
            var r2m = (r2y1 - r2y2) / (r2x1 - r2x2);
            var r2b = r2y1 - (r2m * r2x1);
            var x = (r2b - r1b) / (r1m - r2m);
            var y = r1m * x + r1b;
            return {
                x: x,
                y: y
            };
        };
        function findIntersectY(r1x1, r1y1, r1x2, r1y2, x) {
            if (r1y1 == r1y2) {
                return {
                    x: x,
                    y: r1y1
                };
            }
            var r1m = (r1y1 - r1y2) / (r1x1 - r1x2);
            var r1b = r1y1 - (r1m * r1x1);
            var y = r1m * x + r1b;
            return {
                x: x,
                y: y
            };
        };
        function findIntersectX(r1x1, r1y1, r1x2, r1y2, y) {
            if (r1x1 == r1x2) {
                return {
                    x: r1x1,
                    y: y
                };
            }
            var r1m = (r1y1 - r1y2) / (r1x1 - r1x2);
            var r1b = r1y1 - (r1m * r1x1);
            var x = (y - r1b) / r1m;
            return {
                x: x,
                y: y
            };
        };
    };
    jQuery.fn.btPosition = function() {
        function num(elem, prop) {
            return elem[0] && parseInt(jQuery.curCSS(elem[0], prop, true), 10) || 0;
        };
        var left = 0,
            top = 0,
            results;
        if (this[0]) {
            var offsetParent = this.offsetParent(),
                offset = this.offset(),
                parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? {
                    top: 0,
                    left: 0
                }: offsetParent.offset();
            offset.top -= num(this, 'marginTop');
            offset.left -= num(this, 'marginLeft');
            parentOffset.top += num(offsetParent, 'borderTopWidth');
            parentOffset.left += num(offsetParent, 'borderLeftWidth');
            results = {
                top: offset.top - parentOffset.top,
                left: offset.left - parentOffset.left
            };
        }
        return results;
    };
    jQuery.fn.btOuterWidth = function(margin) {
        function num(elem, prop) {
            return elem[0] && parseInt(jQuery.curCSS(elem[0], prop, true), 10) || 0;
        };
        return this["innerWidth"]() + num(this, "borderLeftWidth") + num(this, "borderRightWidth") + (margin ? num(this, "marginLeft") + num(this, "marginRight") : 0);
    };
    jQuery.fn.btOn = function() {
        return this.each(function(index) {
            if (jQuery.isFunction(this.btOn)) {
                this.btOn();
            }
        });
    };
    jQuery.fn.btOff = function() {
        return this.each(function(index) {
            if (jQuery.isFunction(this.btOff)) {
                this.btOff();
            }
        });
    };
    jQuery.bt.vars = {
        clickAnywhereStack: [],
        closeWhenOpenStack: []
    };
    jQuery.bt.docClick = function(e) {
        if (!e) {
            var e = window.event;
        };
        if (!$(e.target).parents().andSelf().filter('.bt-wrapper, .bt-active').length && jQuery.bt.vars.clickAnywhereStack.length) {
            $(jQuery.bt.vars.clickAnywhereStack).btOff();
            $(document).unbind('click', jQuery.bt.docClick);
        }
    };
    jQuery.bt.defaults = {
        trigger: 'hover',
        clickAnywhereToClose: true,
        closeWhenOthersOpen: false,
        shrinkToFit: false,
        width: '200px',
        padding: '10px',
        spikeGirth: 10,
        spikeLength: 15,
        overlap: 0,
        overlay: false,
        killTitle: true,
        textzIndex: 9999,
        boxzIndex: 9998,
        wrapperzIndex: 9997,
        offsetParent: null,
        positions: ['most'],
        fill: "rgb(255, 255, 102)",
        windowMargin: 10,
        strokeWidth: 1,
        strokeStyle: "#000",
        cornerRadius: 5,
        centerPointX: .5,
        centerPointY: .5,
        shadow: false,
        shadowOffsetX: 2,
        shadowOffsetY: 2,
        shadowBlur: 3,
        shadowColor: "#000",
        shadowOverlap: false,
        noShadowOpts: {
            strokeStyle: '#999'
        },
        cssClass: '',
        cssStyles: {},
        activeClass: 'bt-active',
        contentSelector: "$(this).attr('title')",
        ajaxPath: null,
        ajaxError: '<strong>ERROR:</strong> <em>%error</em>',
        ajaxLoading: '<blink>Loading...</blink>',
        ajaxData: {},
        ajaxType: 'GET',
        ajaxCache: true,
        ajaxOpts: {},
        preBuild: function() {},
        preShow: function(box) {},
        showTip: function(box) {
            $(box).show();
        },
        postShow: function(box) {},
        preHide: function(box) {},
        hideTip: function(box, callback) {
            $(box).hide();
            callback();
        },
        postHide: function() {},
        hoverIntentOpts: {
            interval: 300,
            timeout: 500
        }
    };
    jQuery.bt.options = {};
})(jQuery);

function ShowWindow(obj,width,height,title,button) {
    obj.dialog({
        width: width,
        height:height,
        title:title,
        buttons: button,
        modal: true,
    });
}
//chat
var chatSaved = false;
function chatReplySave() {
    $('#form_reply textarea').removeClass('error');
    var message = $('#form_reply textarea').val();
    var order_sn = $('#chat').find("#order_sn").text();
    var arrInputValues = new Array();
    var arr ="";
    $("#chat input[name='pics']").each(function(){
        arr = arr+","+$(this).val();
    });
    if (message == '') {
        $('#form_reply textarea').addClass('error');
    } else if(message.length>500){
        showError(getTranslation('max_words'));
    }else {
        if (!chatSaved) {
            $('#form_reply textarea').attr('disabled', 'disabled');
            $("#chat #chat_reply_save").linkbutton('disable');
            chatSaved = true;
            $.ajax({
                url: baselocation+'/orderMesg/chatReply/',
                type: 'post',
                data: {
                    order_sn: order_sn,
                    message: message,
                    chatpics:arr,
                },
                success: function(data) {
                    console.log(data);
                    chatSaved = false;
                    if (!data.code==1) return false;
                    chatClearFormReply(data.order_id);
                    $('#form_reply textarea').removeAttr('disabled');
                    $("#chat #chat_reply_save").linkbutton('enable');
                }
            });
        }
    }
}
function chatClearFormReply(order_id) {
    $('#form_reply textarea').val('');
    $.ajax({
        url: baselocation+'/orderMesg/chatReply/',
        type: 'get',
        data: {order_id:order_id},
        success: function(data) {
            var item =data.chat;
            var myData = new Date();
            var timesid = myData.getTime();
            $('#chat_view').append("<div    class='msg_row " + (item.is_me == '1' ? 'my_msg': '') + "'><div class='msg_user'>" + item.name + (item.agent != "" ? '<span title="online" class="user_online">&nbsp;</span>': '<span title="offline" class="user_offline">&nbsp;</span>') + "<br / >" + item.add_Date + (item.agent != "" ? ("<br />" +getTranslation('common_sender')) : ("<br />" +getTranslation('common_receiver'))) + "</div><div class='msg' style='zword-break:break-all;width:50px'>" + item.chat_content + "  <div id = 'chatdiv_"+timesid+"'  style='margin-top:10px;' >   </div>" +
                "" + "</div><div class='clear'></div>" + "<div class='clear'></div></div>");
            var chatdivid = '#chatdiv_'+timesid;
            if(null != item.picss){
                for(var key in item.picss){
                    if(null != item.picss[key] && item.picss[key].length >0){
                        $(chatdivid).append("<a href='"+item.picss[key]+"' target='_blank'><img	src='"+item.picss[key]+"' style='max-width: 100px; max-height: 100px; margin-right: 20px; margin-bottom: 20px; '></a> ");
                    }
                }
            }
            $('#orderpics').empty();
            $('#uploadorderpics').empty();
        }
    });
}
//下侧  个人正在进行的订单
function paintArrangements(data) {
	console.log(data);
	if(!data.rows){return}
    $('#cell_arrg').html('');
    for (var i = 0; i < data.rows.length; i++) {
        var ar = window.ar = data.rows[i];
        var id = 'arrg_' + ar.id;
        var id2 = 'arrg_' + ar.id + "_2";
        var div;
        if(selectedUserId !=''){
            div=$('<div class="arrg" onclick="myarrangeInfo('+ar.id+')"><table width="100%" border="0" cellspacing="2" cellpadding="2" class="arrg_tbarrg"><tbody><tr><td width="36" rowspan="2" class="arrg_num"><img src="" width="36" height="36" class="arrg_status_img"><br><span class="arrg_sm10"><span class="translate">'+getTranslation("Number")+'</span>:<br></span>R<span class="arrg_id"></span></td><td class="arrg_status_name"></td><td class="arrg_wait"><span class="translate">'+getTranslation("The execution of the left")+'</span>: <span class="arrg_red"></span></td><td class="arrg_msg" style="width:120px;"><span>Information:'+ar.chat_number+'</span></td></tr><tr><td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="arrg_num"><span class="arrg_sm10"><span class="translate">'+getTranslation("Creation date")+'</span>:<br> </span><span class="arrg_date"></span></td><td class="arrg_name1"><span class="arrg_user_in"></span><div class="arrg_bank_in"></div></td><td align="center" class="arrg_summ"><span class="arrg_summ_in">&gt;</span> &nbsp;<span class="arrg_amt"></span> &nbsp;<span class="arrg_summ_out">&gt;</span><div class="arrg_out_files" style=""></div></td><td class="arrg_name2"><span class="arrg_user_out"></span><div class="arrg_bank_out"></div></td><td width="30"><img src="/Public/Home/style/member/img/printout.png" width="30" height="30" onclick="arrgClickPrint(event, this); return false;" style="cursor:pointer;" class="arrg_print"></td></tr><tr><td colspan="5" style="text-align:right;padding-top:5px;"><a href="javascript:void(0);" class="neoui-greybutton translate" onclick="myarrangeInfo('+ar.id+')">Details&gt;&gt;</a></td></tr></tbody></table></td></tr></tbody></table></div>');
        }else{
            div=$('<div class="arrg" onclick="myarrangeInfo('+ar.id+')"><table width="100%" border="0" cellspacing="2" cellpadding="2" class="arrg_tbarrg"><tbody><tr><td width="36" rowspan="2" class="arrg_num" onclick="showArrg(\''+id2+'\')"><img src="" width="36" height="36" class="arrg_status_img"><br><span class="arrg_sm10"><span class="translate">'+getTranslation("Number")+'</span>:<br></span>R<span class="arrg_id"></span></td><td class="arrg_status_name"></td><td class="arrg_wait"><span class="translate">'+getTranslation("The execution of the left")+'</span>: <span class="arrg_red"></span></td><td class="arrg_msg" style="width:120px;" onclick="showChat('+ar.id+')"><span>'+getTranslation("Info")+':'+ar.chat_number+'</span></td></tr><tr><td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="arrg_num"><span class="arrg_sm10"><span class="translate">'+getTranslation("Creation date")+'</span>:<br> </span><span class="arrg_date"></span></td><td class="arrg_name1"><span class="arrg_user_in"></span><div class="arrg_bank_in"></div></td><td align="center" class="arrg_summ"><span class="arrg_summ_in">&gt;</span> &nbsp;<span class="arrg_amt"></span> &nbsp;<span class="arrg_summ_out">&gt;</span><div class="arrg_out_files" style=""></div></td><td class="arrg_name2"><span class="arrg_user_out"></span><div class="arrg_bank_out"></div></td><td width="30"><img src="/Public/Home/style/member/img/printout.png" width="30" height="30" onclick="arrgClickPrint(event, this); return false;" style="cursor:pointer;" class="arrg_print"></td></tr><tr><td colspan="5" style="text-align:right;padding-top:5px;"><a href="javascript:void(0);" class="neoui-greybutton translate" onclick="myarrangeInfo('+ar.id+')">'+getTranslation("More")+'</a></td></tr></tbody></table></td></tr></tbody></table></div>');
        }
		if(ar.status == 2){
			div.addClass('arrg_over');
		}else{
			div.addClass('arrg_' + ar.ustatus);
		}
        div.attr('id', id);
        div.attr('id_arrangement', ar.id);
        //div.data('is_transfer', false);
        div.appendTo('#cell_arrg');
        $('#' + id + " .arrg_id").html(ar.id);
        if(ar.c_type==840){
            $('#' + id + " .arrg_amt").html(ar.amount+ ' USDT'+'<br>'+ar.bit_amount+' BTC');
            $('#' + id + " .arrg_bank_in").html('BitCoin');
            $('#' + id + " .arrg_bank_out").html('BitCoin');
        }else{
            $('#' + id + " .arrg_amt").html(ar.amount+ ' USDT'+'<br>'+ar.bit_amount+' CNY');
            $('#' + id + " .arrg_bank_in").html('Bank');
            $('#' + id + " .arrg_bank_out").html('Bank');
        }
        if (ar.bit_amount) {
            $('#' + id + " .arrg_amt").css('font-size', '14px').css('display', 'inline-block');
        }
        if(ar.ustatus=='out'){
            $('#' + id + " .arrg_status_name").html(ar.status_name+"("+getTranslation('ORDER_TYPE_OUT2')+" Z"+ar.total_order_sn+")");
        }else{
            $('#' + id + " .arrg_status_name").html(ar.status_name +"("+ getTranslation('ORDER_TYPE_IN2')+" Z"+ar.total_order_sn+")");
        }
        $('#' + id + " .arrg_status_img").attr('src', '/Public/Home/style/member/img/'+ar.status_img+'.png');
        $('#' + id + " .arrg_date").html(ar.date);
        if (ar.order_states==0 && ar.red > 0) {
            $('#' + id + " .arrg_wait .arrg_red").html(ar.red + " " + getTranslation('desktop_hours'));
        } else {
            $('#' + id + " .arrg_wait").html('');
        }
        $('#' + id + " .arrg_user_in").html(ar.ustatus == 'in' ? getTranslation('You') : ar.put_name);
        $('#' + id + " .arrg_user_out").html(ar.ustatus == 'out' ? getTranslation('You') : ar.get_name);
        if (ar.files && ar.files.length > 0) {
            $('#' + id + ' .arrg_out_files').show();
            var pics = ar.files.split(',');
            var picshtml = '';
            for(var j=0;j<pics.length;j++){
                $("<a href=\"" + pics[j] + "\" target=\"_blank\" class=\"_screens\"><img src='/Public/Home/style/member/img/icons/file.png'></a>").appendTo('#' + id + ' .arrg_out_files');
            }
        }
        $('._screens').click(function(event) {
            if (event.stopPropagation) {
                event.stopPropagation();
            } else {
                event.cancelBubble = true;
            }
        });
        $('#' + id + " .arrg_print").hide();
        var div2 = $('<div style="height: 0px; overflow: hidden; margin-top: -10px; margin-bottom: 10px;"><div class="arrg" style="width:400px; margin-left:70px; "><table width="100%" border="0" cellspacing="0" cellpadding="6"><tbody></tbody></table></div></div>');;
        div2.attr('id', id2);
        div2.appendTo('#cell_arrg');
        var t_statuses = $('#' + id2 + ' table')[0];
		console.log(ar);
		var abc=[
			{
				img:123
			}
		]
        for (var j = 0; j < ar.variants.length; j++) {
            div2.height(1);
            var row = t_statuses.insertRow(t_statuses.rows.length);
            row.className = 'arrg_tovover';
            var innerHTML = '<td><img src="/Public/Home/style/member/img/'+ar.variants[j].img+'.png" width="55" height="32" /></td>';
            innerHTML += '<td><a href="#" style="text-decoration:none" onclick="handlerStatus'+ar.variants[j].status+'('+ar.id+')">'+getTranslation(ar.variants[j].n)+'</a></td>';
            $(row).html(innerHTML);
        }
        $('#' + id2).hide();
        $('#' + id).css("cursor", "pointer");
    }
    loadExpiredArrangementsLinkBlock();
    $('#arrg_pagination').pagination({
        total: data.total,
        pageNumber: current_arrg_page,
        pageSize: current_arrg_rows,
        loading: true,
        displayMsg: '',
        showRefresh: false,
        onSelectPage: function(pageNumber, pageSize) {
            $(this).pagination('loading');
            alert('new_desktop.js第1096行')
            current_arrg_page = pageNumber;
            toCookie('desktop', 'current_arrg_rows', pageSize);
            current_arrg_rows = pageSize;
            loadArrangements();
            $(this).pagination('loaded');
        }
    });
    $('#arrg_pagination').show();
}
//页面加载数据
function loadArrangementsAndOrders() {
    loadingShow();
    var data=[];
    $.ajax({
        url:"/Home/Indexnew/loadArrangementsAndOrders/",
        type: 'get',
        data :{
			pageNumber:current_arrg_page,
			pageSize:current_arrg_rows,
			u:selectedUserId,
			show_expired_arrangements:$('#show_expired_arrangements').val()
		},
        dataType: 'json',
        success:function(result){
            loadingHide();
            data = 	result;
			console.log(result);
            paintArrangements(data.arrangements);
            paintOrders(data.orders);
        }
    });
}
function loadArrangements() {
    loadingShow();
    var data=[];
    $.ajax({
        url:baselocation+"/Arrangements/json/",
        type: 'get',
        data :{pageNumber:current_arrg_page,pageSize:current_arrg_rows,u:selectedUserId,show_expired_arrangements:$('#show_expired_arrangements').val()},
        dataType: 'json',
        success:function(result){
            loadingHide();
            data = 	result;
            paintArrangements(data.arrangements);
        }
    });
}
function showArrg(id){
    $("#"+id).show();
    var height=150;
    if($("#"+id).find('.arrg_tovover').length==1){
        height=80;
    }
    var thiz_obj=$("#"+id);
    if(parseInt(thiz_obj.height())==1)
    {
        thiz_obj.show();
        thiz_obj.stop().animate({ height: height }, 1000);
    }else if(parseInt(thiz_obj.height())==0){
        return;
    }
    else{
        thiz_obj.stop().animate({ height: 1 }, 1000,function(){
            thiz_obj.hide();
        });
    }
    event.stopPropagation();
}
function myarrangeInfo(order_sn){
    showLeftOrderTip(order_sn);
    ShowWindow($("#arrange_info"),900,500,getTranslation('arrg_info'),"#order_tip_buttons");
}
function showChat(order_sn){
    $("#chat").find('#order_sn').text(order_sn);
    loadingShow();
    $.ajax({
        url:baselocation+"/orderMesg/chats/",
        type: 'get',
        data :{order_sn:order_sn},
        dataType: 'json',
        success:function(result){
            $('#chat_view').empty();
            $('#uploadorderpics').empty();
            loadingHide();
            $.each(result.chats, function(i, item) {
                var myData = new Date();
                var timesid = myData.getTime() + i;
                $('#chat_view').append("<div class='msg_row"+(item.is_me == '1' ? 'my_msg': '')+"'><div class='msg_user'>" + item.name+(item.is_me == '1' ? '<span title="online" class="user_online">&nbsp;</span>': '<span title="offline" class="user_offline">&nbsp;</span>')+"<br/>"+item.add_Date+(item.agent != "" ? ("<br/>" +getTranslation('common_sender')) : ("<br/>" +getTranslation('common_receiver')))+"</div><div class='msg' style='word-break:break-all;width:380px'>" + item.chat_content + "  <div id = 'chatdiv_"+timesid+"' style='margin-top:10px;'></div>"+"</div><div class='clear'></div>"+"<div class='clear'></div></div>");
                var chatdivid = '#chatdiv_'+timesid;
                if(null != item.picss){
                    for(var key in item.picss){
                        if(null != item.picss[key] && item.picss[key].length >0){
                            $(chatdivid).append("<a	href='"+item.picss[key]+"'target='_blank'><img src='"+item.picss[key]+"' style='max-width: 100px; max-height: 100px; margin-right: 20px; margin-bottom: 20px; '></a> ");
                        }
                    }
                    $('#orderpics').empty();
                }
            });

        }
    });
    // var show_mode=$(this).data("show");
    ShowWindow($("#chat"),880,570,getTranslation('chat_chat'));
    event.stopPropagation();
}
function loadExpiredArrangementsLinkBlock() {
    deleteExpiredArrangementsLinkBlock();
    var classLink = 'show_expired_arrangements_link';
    var tip = 'desktop_hide_expired_arrangements';
    var touch= 'hideExpiredArrangements';
    if ($('#show_expired_arrangements').val()==0) {
        classLink = 'hide_expired_arrangements_link';
        tip = 'desktop_show_expired_arrangements';
        touch= 'showExpiredArrangements';
    }
    var item = $('<div><nobr><a class="easyui-linkbutton l-btn" href="#" onclick="'+touch+'();"><span class="l-btn-left"><span class="l-btn-text">'+getTranslation(tip)+'</span></span></a></nobr></div>');
    item.addClass(classLink);
    item.css('margin-right', '8px');
    item.css('margin-bottom', '8px');
    item.css('float', 'right');
    item.appendTo($('#cell_arrg'));
    item.attr('attr', 'clone');
    item.show();
}
function showExpiredArrangements() {
    $('#show_expired_arrangements').val(1);
    expiredArrangements(true);
}
function hideExpiredArrangements() {
    $('#show_expired_arrangements').val(0);
    expiredArrangements(false);
}
function expiredArrangements(show) {
    deleteExpiredArrangementsLinkBlock();
    loadingShow();
    loadArrangements();
}
function deleteExpiredArrangementsLinkBlock() {
    $('.show_expired_arrangements_link[attr=clone]').remove();
    $('.hide_expired_arrangements_link[attr=clone]').remove();
}
function deleteArchivedOrdersLinkBlock() {
    $('.show_archived_orders_link[attr=clone]').remove();
    $('.hide_archived_orders_link[attr=clone]').remove();
}
//右侧 个人订单
function paintOrders(data) {
	console.log(data);
    $('#cell_orders').html('');
    for (var i = 0; i < data.rows.length; i++) {
        var r = data.rows[i];
        var id = 'order_' + r.type + '_' + r.id;
        var div = '';
        if(r.type=='in'){
            div = $('<div class="ordin show_right show_right_detail"><table width="100%" border="0" cellspacing="6" cellpadding="0"><tbody><tr><td><img src="/Public/Home/style/member/img/strelka32.png" width="32" height="32"></td><td class="ord_title"><span class="translate">'+getTranslation('ORDER_TYPE_IN2')+'</span><br>Z<span class="order_in_id"></span></td></tr><tr><td colspan="2" class="ord_body"><div class="ord_body_info"><span class="translate">'+getTranslation("mmb_simple")+'</span>: <span class="order_in_fio"></span><br><span class="translate">'+getTranslation("Amount")+'</span>: <span class="order_in_amount"></span><span class="order_in_currency"></span><br><span class="rest_in" style="display:block"><span class="translate">'+getTranslation("Balance")+'</span>: <span class="order_in_rest"></span><span class="order_in_currency">USDT</span><br></span><span class="translate">'+getTranslation("Date")+'</span>: <span class="order_in_date"></span><br><span class="order_in_mavro"></span><br><span class="translate">'+getTranslation("Status")+'</span>: <span class="order_in_status"></span></div><div class="ord_body_is_avto"><img src="/Public/Home/style/member/img/avto37.png" alt=""></div></td></tr><tr><td colspan="2"><a href="javascript:void(0);" class="neoui-greybutton translate" style="float:right;">'+getTranslation("More")+'</a></td></tr></tbody></table></div>');
        }else{
            if(r.s==5 || r.s==8 && selectedUserId==''){
                div = $('<div class="ordout show_right show_right_detail"><table width="100%" border="0" cellspacing="6" cellpadding="0"><tbody><tr><td class="ord_title"><span class="translate">'+getTranslation('ORDER_TYPE_OUT2')+'</span><br>Z<span class="order_out_id"></span></td><td><img src="/Public/Home/style/member/img/strelka_32.png" width="32" height="32"></td></tr><tr><td colspan="2" class="ord_body"><div class="ord_body_info"><span class="translate">'+getTranslation("mmb_simple")+'</span>: <span class="order_out_fio"></span><br><span class="translate">'+getTranslation("Amount")+'</span>: <span class="order_out_amount"></span><span class="order_out_currency"></span><br><span class="rest_out"><span class="translate">'+getTranslation("Balance")+'</span>: <span class="order_out_rest"></span><span class="order_out_currency">USDT</span><br></span><span class="translate">'+getTranslation("Date")+'</span>: <span class="order_out_date"></span><br><span class="order_out_mavro"></span><br><span class="translate">'+getTranslation("Status")+'</span>: <span class="order_out_status"></span></div><div class="ord_body_is_avto"><img src="/Public/Home/style/member/img/avto37.png" alt=""></div></td></tr><tr><td colspan="2"><a onclick="writeHappyMessage('+r.id+')" class="neoui-greybutton translate write" style="float:left;" >'+getTranslation("Write message happy")+'</a><a href="javascript:void(0);" class="neoui-greybutton translate" style="float:right;">'+getTranslation("More")+'</a></td></tr></tbody></table></div>');
            }else{
                div = $('<div class="ordout show_right show_right_detail"><table width="100%" border="0" cellspacing="6" cellpadding="0"><tbody><tr><td class="ord_title"><span class="translate">'+getTranslation('ORDER_TYPE_OUT2')+'</span><br>Z<span class="order_out_id"></span></td><td><img src="/Public/Home/style/member/img/strelka_32.png" width="32" height="32"></td></tr><tr><td colspan="2" class="ord_body"><div class="ord_body_info"><span class="translate">'+getTranslation("mmb_simple")+'</span>: <span class="order_out_fio"></span><br><span class="translate">'+getTranslation("Amount")+'</span>: <span class="order_out_amount"></span><span class="order_out_currency"></span><br><span class="rest_out"><span class="translate">'+getTranslation("Balance")+'</span>: <span class="order_out_rest"></span><span class="order_out_currency">USDT</span><br></span><span class="translate">'+getTranslation("Date")+'</span>: <span class="order_out_date"></span><br><span class="order_out_mavro"></span><br><span class="translate">'+getTranslation("Status")+'</span>: <span class="order_out_status"></span></div><div class="ord_body_is_avto"><img src="/Public/Home/style/member/img/avto37.png" alt=""></div></td></tr><tr><td colspan="2"><a href="javascript:void(0);" class="neoui-greybutton translate" style="float:right;">'+getTranslation("More")+'</a></td></tr></tbody></table></div>');
            }
        }
        div.attr('id', id);
        div.attr('id_order', r.id);
        div.appendTo('#cell_orders');
        $('#' + id + " .order_" + r.type + "_fio").html(r.fio);
        $('#' + id + " .order_" + r.type + "_amount").html(r.amount.replace(",","."));
        $('#' + id + " .order_" + r.type + "_rest").html(r.r.replace(",","."));
        if (r.r == r.amount || r.r == '0,00') {
            $('#' + id + " .rest_" + r.type).hide();
        }
        $('#' + id + " .order_" + r.type + "_currency").html(' USDT');
        $('#' + id + " .order_" + r.type + "_date").html(r.date);
        $('#' + id + " .order_" + r.type + "_status").html(getTranslation(r.status));
        $('#' + id + " .order_" + r.type + "_id").html(r.id);
        if (r.s >= 2) {
            $('#' + id).addClass('hidden');
        }
        if (['in', 'out'].indexOf(r.type) >= 0) {
            $('#' + id).css("cursor", "pointer");
            $('#' + id).click(function(event) {
                orderInfo($(this).attr('id_order'));
            });
        }
    }
    loadArchivedOrdersLinkBlock();
    $('#orders_pagination').pagination({
        total: data.total,
        pageNumber: current_orders_page,
        pageSize: current_orders_rows,
        loading: true,
        displayMsg: '',
        showRefresh: false,
        onSelectPage: function(pageNumber, pageSize) {
        	alert('new_desktop.js第1289行');
            $(this).pagination('loading');
            current_orders_page = pageNumber;
            toCookie('desktop', 'current_orders_rows', pageSize);
            current_orders_rows = pageSize;
            loadOrders();
            $(this).pagination('loaded');
        }
    });
    $('#orders_pagination').show();
}
function deleteArchivedOrdersLinkBlock() {
    $('.show_archived_orders_link[attr=clone]').remove();
    $('.hide_archived_orders_link[attr=clone]').remove();
}
function loadArchivedOrdersLinkBlock() {
    deleteArchivedOrdersLinkBlock();
    var classLink = 'show_archived_orders_link';
    var tip = 'desktop_hide_archived_orders';
    var touch= 'hideArchivedOrders';
    if ($('#show_expired_order').val()==0) {
        classLink = 'hide_archived_orders_link';
        tip = 'desktop_show_archived_orders';
        touch= 'showArchivedOrders';
    }
    var item = $('<div><nobr><a class="easyui-linkbutton l-btn" href="#" onclick="'+touch+'();"><span class="l-btn-left"><span class="l-btn-text">'+getTranslation(tip)+'</span></span></a></nobr></div>');
    item.css('margin-left', '8px');
    item.css('margin-bottom', '8px');
    item.css('float', 'right');
    item.appendTo($('#cell_orders'));
    item.attr('attr', 'clone');
    item.show();
}
function showArchivedOrders() {
    $('#show_expired_order').val(1);
    archivedOrders(true);
}
function hideArchivedOrders() {
    $('#show_expired_order').val(0);
    archivedOrders(false);
}
function archivedOrders(show) {
    deleteArchivedOrdersLinkBlock();
    loadOrders();
}
function loadOrders() {
    loadingShow();
    $.ajax({
        url:baselocation+"/Orders/json",
        type: 'get',
        data :{pageNumber:current_orders_page,pageSize:current_orders_rows,u:selectedUserId,show_expired_order:$('#show_expired_order').val()},
        dataType: 'json',
        success: function(data) {
            loadingHide();
            // if (!handleState(data)) return false;
            paintOrders(data);
        }
    });
}
function orderInfo(order_sn){
    loadingShow();
    $fn = $('#order_info');
    var html="";
    $.ajax({
        url:"/Home/Indexnew/paintOrdersDetails",
        type: 'get',
        data:{order_sn:order_sn},
        dataType: 'json',
        success:function(result){
			console.log(result);
            loadingHide();
            $fn.find('.order_out_fio').html(result.orderMesg.name);
            if(result.orderMesg.type==0){
                $('#show_right2').show();
                $('#show_right4').hide();
                if(result.orderMesg.states==4){
                    $('#show_right1').attr('class','ordin hidden');
                }else{
                    $('#show_right1').attr('class','ordin show_right');
                }
            }else if(result.orderMesg.type==1){
                $('#show_right4').show();
                $('#show_right2').hide();

                if(result.orderMesg.states==4){
                    $('#show_right1').attr('class','ordout hidden');
                }else{
                    $('#show_right1').attr('class','ordout show_right');
                }
            }
            hmtl='<span class="translate">'+getTranslation('Members')+'</span><br>';
            hmtl=hmtl+'Z<span class="order_out_id">'+result.orderMesg.order_sn+'</span></td>';
            $('#show_right3').html(hmtl);
            $('#show_right11').html(result.orderMesg.total_amount.replace(",","."));
            $('#show_right5').html(result.orderMesg.addDate);
            if(result.orderMesg.states==0){
                $('#show_right6').html(getTranslation('STATUS_ORD_NEW'));
            }else if(result.orderMesg.states==1){
                $('#show_right6').html(getTranslation('STATUS_ORD_PROGRESS1_2'));
            }else if(result.orderMesg.states==2){
                $('#show_right6').html(getTranslation('STATUS_ORD_DONE'));
            }else if(result.orderMesg.states==4){
                $('#show_right6').html(getTranslation('check_filter_remove_text'));
            }
            //
            $('#show_right7').html(getTranslation('common_account_information_not_available')+"(USDT)");
            $('#show_right8').html(result.orderMesg.addDate);
            $('#show_right9').html(result.orderMesg.total_amount.replace(",","."));
            $('#show_right10').html(result.orderMesg.total_amount.replace(",","."));
        }
    });
    var show_mode=$(this).data("show");
    ShowWindow($("#order_info"),800,500,getTranslation('desktop_order_detailed'),"#order_info_buttons");
}
function loadMemberData(id){
    selectedUserId = id;
    loadData();
}
function loadData(){
    loadArrangementsAndOrders();
}
$(function(){
    //init
    current_arrg_page = 1;
    current_arrg_rows = fromCookie('desktop', 'current_arrg_rows') != 0 ? fromCookie('desktop', 'current_arrg_rows') : 10;
    current_orders_page = 1;
    current_orders_rows = fromCookie('desktop', 'current_orders_rows') != 0 ? fromCookie('desktop', 'current_orders_rows') : 10;
    selectedUserId = '';
    loadArrangementsAndOrders()
    if (document.getElementById('lst_users')) {
//	        $('#lst_users').combobox({
//	            required: true,
//	            multiple: false,
//	            valueField: 'id',
//	            textField: 'uname',
//	            mode: 'remote',
//	            url: baselocation+'/desktop/members',
//	            onSelect: function(row) {
//	                selectedUserId = row.id;
//	                alert(selectedUserId);
//	                loadData();
//	            }
//	        });
        var options = '';
        $.ajax({
            url:baselocation+'/desktop/members',
            type: 'GET',
            success:function(result){
                for(var i=0;i<result.length;i++){
                    options = options+'<div onclick="loadMemberData('+result[i].id+')" class="combobox-item">'+result[i].uname+'</div>';
                }
                $('#members').append(options);
            }
        })
    }
	//提供帮助按钮
    $("#put_help").on("click",function(){
        loadingShow();
        var show_mode=$(this).data("show");
        $.ajax({
            url:"/Home/Indexnew/tgbz",
            type: 'GET',
            success:function(result){
				if(result.status==-1){
                    showAlert(result.info);
                    loadingHide();
                    return;
                }
                loadingHide();
                if(result.code==0){
                    showAlert(getTranslation('You_can_not_create_a_provide_help'),false);
                }else if(result.code==2){
                    showAlert(getTranslation('You_has_not_payed_arrangements'),false);
                }else if(result.code==1){
                    setTimeout(function(){
                        $(".wizard",$("#winh")).hide();
                        $(".wizard1",$("#winh")).show();
                        ShowWindow($("#"+show_mode ),608,"auto",'<div class="panel-title panel-with-icon" style="">'+getTranslation('Add request')+'</div><div class="panel-icon icon-save"></div')
                        $('.panel-tool-close').hide();
                    },500);
                }else if(result.code==5){
                    showAlert(getTranslation('due_to_frozen_principal'));
                }else{
                    loadingHide();
                }
            }
        })

    });
    $('.ned_close').on("click",function(){
        var $par=$(this).parents(".window");
        $(".panel-tool-close",$par).click();
    })
    //putHelCancel
    $('#winh').find('a[iconcls="icon-cancel"],.ned_close').on("click",function(){
        loadingShow();
        $(".wizard1",$("#winh")).find('#wizard_field_winh_terms_ok').attr("checked",false);
        $(".wizard3",$("#winh")).find('#wizard_field_winh_sum_mavro').val('');
        $(".wizard3",$("#winh")).find('#wizard_field_winh_sum_mavro').prop("disabled",false);
        $(".wizard3",$("#winh")).find('#wizard_field_winh_sum_mavro2').val('');
        $(".wizard3",$("#winh")).find('#wizard_field_winh_sum_mavro2').prop("disabled",true);
        $(".wizard3",$("#winh")).find('._ototal').html('');
        $(".wizard3",$("#winh")).find('#wizard_field_winh_get_bonus').attr("checked",false);
        $(".wizard4",$("#winh")).find('#capcha').val('');
        var $par=$(this).parents(".window");
        $(".panel-tool-close",$par).click();
        setTimeout(function(){
            loadingHide();
        },500)
        location.reload();
    });
    $(".combo-arrow").on("click",function(){
        var $par=$(this).parents(".field_combo");
        var $obj=$(".field_comboBox",$par);
        $obj.toggle();
        $(".combobox-item",$obj).off("click").on("click",function(){
            $(".combobox-item",$obj).removeClass("combobox-item-selected");
            $(this).addClass("combobox-item-selected");
            if($(this).attr('data-id')==850){
                $(':radio[name="new_radio"]').eq(1).attr("checked",true);
            }else if($(this).attr('data-id')==840){
                $(':radio[name="new_radio"]').eq(0).attr("checked",true);
            }else{
                $(':radio[name="new_radio"]').eq(0).attr("checked",true);
            }
            $('#winh_currency_id').val($(this).attr('data-id'));
            $(".validatebox-text",$par).val($(this).html());
            $obj.hide();
        })
    })
    $("input[name=new_radio]").click(function(){
        var $par=$(".combo-arrow").parents(".field_combo");
        var $obj=$(".field_comboBox",$par);
        if($(this).val()==1){
            $('#c_840').addClass("combobox-item-selected");
            $('#c_850').removeClass("combobox-item-selected");
            $(".validatebox-text",$par).val('BitCoin(BTC)');
            $('#winh_currency_id').val(840);
        }else{
            $('#c_850').addClass("combobox-item-selected");
            $('#c_840').removeClass("combobox-item-selected");
            $(".validatebox-text",$par).val('人民币(CNY)');
            $('#winh_currency_id').val(850);
        }
    });
    $(document).on('mousedown',function(e){
        var elt=$(e.target).parents(".field_combo").length;
        var localName=$(e.target).context.localName;
        if(elt==0){
            $(".field_comboBox").hide();
        }
    });
    //put_help
    $(".wizard_next",$("#winh")).on("click",function(){
        var selt=$("#wizard_field_winh_terms_ok").prop("checked");
        if(selt){
            var $par=$(this).parents(".window");
            $(".wizard",$("#winh")).hide();
            $(".wizard2",$("#winh")).show();
            $par.css("top","40px");
        }else{
            $("#show_err .err_count").html(getTranslation('you_must_accept_terms'));
            ShowWindow($("#show_err" ),288,"auto",getTranslation('Attention'));
        }
    });
    $(".wizard_pre",$("#winh")).on("click",function(){
        var $par=$(this).parents(".window");
        $(".wizard",$("#winh")).hide();
        $(".wizard1",$("#winh")).show();
        $par.css("top","190px");
    });
    $(".wizard_next2",$("#winh")).on("click",function(){
        var selt=$("input[name='new_radio']").is(":checked");
        // if( $('#winh_currency_id').val()==850){
            // $.ajax({
                // url:baselocation+"/activation_code/ifActivate",
                // type: 'get',
                // dataType: 'json',
                // success:function(result){
                    // if(result.code==0){
                        // $('#doValidate_token').val(result.token);
                        // enterCode();
                        // return false;
                    // }else{
                        // var $par=$(this).parents(".window");
                        // $(".wizard",$("#winh")).hide();
                        // $(".wizard3",$("#winh")).show();
                        // $par.css("top","143px");
                        // $.ajax({
                            // url:baselocation+"/put_help/canPutHelpAmount",
                            // type: 'get',
                            // dataType: 'json',
                            // success:function(result){
                                // $('._omultiplie').html(getTranslation('adepost_crat_sum')+'10. '+format(getTranslation('you_order_can_be_min_{0}USD'), {0:result.min_amount})+'. '+format(getTranslation('you_order_can_be_max_{0}USD'), {0:result.max_amount}));
                                // $('#min_amount').val(result.min_amount);
                                // $('#max_amount').val(result.max_amount);
                            // }
                        // });
                    // }
                // }
            // });
        // }else{
            var $par=$(this).parents(".window");
            $(".wizard",$("#winh")).hide();
            $(".wizard3",$("#winh")).show();
            $par.css("top","143px");
            $.ajax({
                url:"/Home/Indexnew/canPutHelpAmount",
                type: 'get',
                dataType: 'json',
                success:function(result){
                    $('._omultiplie').html(getTranslation('adepost_crat_sum')+'10. '+format(getTranslation('you_order_can_be_min_{0}USD'), {0:result.min_amount})+'. '+format(getTranslation('you_order_can_be_max_{0}USD'), {0:result.max_amount}));
                    $('#min_amount').val(result.min_amount);
                    $('#max_amount').val(result.max_amount);
                }
            });
        //}
        $(".window-shadow").css("height","auto");
    });
    $(".wizard_pre2",$("#winh")).on("click",function(){
        var $par=$(this).parents(".window");
        $(".wizard",$("#winh")).hide();
        $(".wizard2",$("#winh")).show();
        $par.css("top","40px");
    });
    $('#wizard_field_winh_sum_mavro').bind('input propertychange', function(event) {
        var min_amount = parseInt($("#min_amount").val());
        var max_amount = parseInt($("#max_amount").val());
        var sum = parseInt($(this).val());
        if (sum%10==0 && sum<=max_amount && sum>=min_amount) {
            $(".wizard_next3",$("#winh")).removeClass("l-btn-disabled");
        }else{
            $(".wizard_next3",$("#winh")).addClass("l-btn-disabled");
        }
    });
    $('#wizard_field_winh_sum_mavro').blur(function(){
        if($("#wizard_field_winh_sum_mavro").val()==""){
            return false;
        }
        var sum = parseInt($("#wizard_field_winh_sum_mavro").val());
        if(sum<10){
            showAlert(getTranslation('you_order_can_not_be_less'));
            $(".wizard_next3",$("#winh")).addClass("l-btn-disabled");
            return;
        }
        var min_amount = parseInt($("#min_amount").val());
        if(sum<min_amount){
            showAlert(format(getTranslation('you_order_can_not_be_less_{0}USD'), {0:min_amount}));
            $(".wizard_next3",$("#winh")).addClass("l-btn-disabled");
            return false;
        }
        var max_amount = parseInt($("#max_amount").val());
        if(sum>max_amount){
            showAlert(format(getTranslation('you_order_can_not_be_more_{0}USD'), {0:max_amount}));
            $(".wizard_next3",$("#winh")).addClass("l-btn-disabled");
            return false;
        }
        $(".wizard_next3",$("#winh")).removeClass("l-btn-disabled");
        sum=sum-sum%10;
        $("#wizard_field_winh_sum_mavro").val(sum);
    })
    $(".wizard_next3",$("#winh")).on("click",function(){
        if($(this).hasClass("l-btn-disabled")){
            return false;
        }
        $.ajax({
            url:baselocation+"/put_help/getToken/",
            type: 'get',
            dataType: 'json',
            success:function(result){
                $("#token_put").val(result.token_put);
            }
        });
        var selt=$("input[name='list_banks']").prop("checked");
        if($("#wizard_field_winh_sum_mavro").val()>=10){
            var $par=$(this).parents(".window");
            $(".wizard",$("#winh")).hide();
            $(".wizard4",$("#winh")).show();
            $par.css("top","143px");
            //$("#wizard_field_winh_all_data").find('h3').html($('#wizard_field_winh_sum_mavro').val()+getTranslation('proAmount'));
            $("#wizard_field_winh_all_data").find('h3').html($('#wizard_field_winh_sum_mavro').val());
            $("#proAmount").html($('#wizard_field_winh_sum_mavro').val());
            $('#create_currency_v').html($('#currency_v').val());
        }
    });
    $(".wizard_next4",$("#winh")).on("click",function(){
        // $('#do_release_btn').linkbutton('disable');
        $(this).removeClass("wizard_next4");
        loadingShow();
        $.ajax({
            url:"/Home/Index/tgbzcl/",
            type: 'POST',
            data:{
                amount: $("#wizard_field_winh_sum_mavro").val(),
                token :$("#token_put").val(),
                cap_ch:$('#capcha').val(),
                cur_type:$('#winh_currency_id').val()
            },
            success:function(result){
                if(result.code==205){
                    showAlert(format(getTranslation('you_order_can_not_be_more_{0}USD'), {0:result.min_amount}));
                    loadingHide();
                    return;
                }
                if(result.code==225){
                    showAlert(getTranslation('active your account'));
                    loadingHide();
                    return;
                }
				if(result.status==-1){
                    showAlert(result.info);
                    loadingHide();
                    return;
                }
                setTimeout(function(){
                    loadingHide();
                },500)
                ShowWindow($("#show_msg" ),288,"auto",getTranslation('Attention'));
                var $par=$("#put_help_close").parents(".window");
                $(".panel-tool-close",$par).off("click.win").on("click.win",function(){
                    var $par_=$(".wizard",$("#winh")).parents(".window");
                    $(".panel-tool-close",$par_).click();
                    location.reload();
                });
            }
        });
    });
    $(".wizard_pre3",$("#winh")).on("click",function(){
        var $par=$(this).parents(".window");
        $(".wizard",$("#winh")).hide();
        $(".wizard3",$("#winh")).show();
        $par.css("top","143px");
    });
    $("#get_help").on("click",function(){
        loadingShow();
        $.ajax({
            url:"/Home/Indexnew/hdbz/",
            type: 'get',
            dataType: 'json',
            success:function(result){
                loadingHide();
				
                if(result.code==1){
                    $(".wizard",$("#winout")).hide();
                    $(".wizard1",$("#winout")).show();
                    ShowWindow($("#winout"),738,"auto",'<div class="panel-title panel-with-icon" style="">'+getTranslation('Add request')+'</div><div class="panel-icon icon-save"></div')
                    $('.panel-tool-close').hide();
                }else if(result.code==2){
                    showAlert(getTranslation('due_to_unfinish_orders'));
                }else if(result.code==5){
                    showAlert(getTranslation('You_has_not_payed_arrangements'),false);
                }else if(result.code==8){
                    showAlert(getTranslation('due_to_unfinish_the_previous_Lette'),false);
                }else if(result.code==0){
                    $(".wizard",$("#winout")).hide();
                    $(".wizard_out_request_not_mavro",$("#winout")).show();
                    ShowWindow($("#winout" ),738,"auto",getTranslation('addord_out_wz_title'));
                }
            }
        });
    });
//getHelpCancel
    $('#winout').find('a[iconcls="icon-cancel"],.ned_close').on("click",function(){
        loadingShow();
        $('#wizard_field_winout_user_mavro_total').val('0');
        $('#wizard_field_winout_user_mavro').find(".item").empty();
        var $par=$(this).parents(".window");
        $(".panel-tool-close",$par).click();
        loadingHide();
    });
    $(".wizard_next",$("#winout")).on("click",function(){
        loadingShow();
        $.ajax({
            url:"/Home/Indexnew/getAccounts/",
            type: 'get',
            dataType: 'json',
            success:function(result){
				if(result.status==-1){
                    showAlert(result.info);
                    loadingHide();
                    return;
                }
				
                loadingHide();
                $("#BitAccount").find("option").remove();
                $.each(result.bitAcounts, function(i, item) {
                    $("#BitAccount").append("<option data-id='"+item.id+"' value='"+item.account_number+"'>"+item.account_name+"</option>");
                });
            }
        });
        var $par=$(this).parents(".window");
        $(".wizard",$("#winout")).hide();
        if($("input[name='typeof_account']:checked").val()=="1"){
            $(".wizard2",$("#winout")).show();
            $par.css("top","152px");
        }else{
            $(".wizard22",$("#winout")).show();
            $par.css("top","152px");
        }
        $(".window-shadow").css("height","auto");
    });
    $(".wizard_pre",$("#winout")).on("click",function(){
        var $par=$(this).parents(".window");
        $(".wizard",$("#winout")).hide();
        $(".wizard1",$("#winout")).show();
        $par.css("top","152px");
    });
    $(".wizard_next2",$("#winout")).on("click",function(){
        loadingShow();
        $.ajax({
            url:"/Home/Indexnew/ifCanGetCNY/",
            type: 'get',
            dataType: 'json',
            data:{bitAccount:$('#BitAccount').find("option:selected").attr('data-id')},
            success:function(result){
                loadingHide();
                if(result.status==0){
                    showAlert(getTranslation('GH_BY_CNY'));
                    return false;
                }else{
                    $('#winout').css('height',420);
                    $(".dialog-content",$("#winout")).css('height',420);
                    $('#mavro-list .item').remove();
                    $('#mavro-list #draw-list').remove();
                    $('#mavro-list #draw-total').remove();
                    $.ajax({
                        url:"/Home/Indexnew/getRemainAmount/",
                        type: 'get',
                        dataType: 'json',
                        success:function(result){
							console.log(result);
                            loadingHide();
                            if(result.code==212){
                                showAlert(getTranslation('Abnormal_account'));
                            }
                            var html = "";
                            $("._outmax").html(parseFloat(result.remain_amount).toFixed(2));
                            $('#wizard_field_winout_user_mavro_rest').val(parseFloat(result.remain_amount).toFixed(2));
                            for (var i = 0; i < result.drawList.length; i++) {
                                var ar = result.drawList[i];
                                var id = 'mavro_'+ ar.id;
                                var tr = $('<tr class="item" ><td style="padding: 2px 15px 2px 0; border-bottom: 1px solid #666666;"><span class="m_type"></span> (Mavro-USD)</td><td id="m_amount" style="text-align: right; padding: 2px 15px 2px 0; border-bottom: 1px solid #666666; white-space: nowrap;"></td><td style="padding: 2px 0 2px 0; border-bottom: 1px solid #666666;"><a class="_all translate l-btn"><span class="l-btn-left"><span class="l-btn-text">All</span></span></a><input style="width: 90px;" class="_money_field _mavro_item" data-id="'+ar.id+'" value="0">United States Dollar</td></tr>');
                                tr.attr('id', id);
                                tr.appendTo('#mavro-list');
                                //$('#' + id + " .m_type").html(getTranslation(ar.m_type));
                                $('#' + id + " .m_type").html('奖金');
                                $('#' + id + " #m_amount").html(ar.format_amount);
                                $('#' + id + " ._mavro_item").attr('data-max',parseFloat(ar.amount).toFixed(2));
                                $('#' + id + " ._mavro_item").attr('data-type',ar.m_type);
                                $('#' + id + " ._all").click(function(){
									console.log($(this).parent().find("._mavro_item").val($(this).parent().find("._mavro_item").attr('data-max')))
                                    $(this).parent().find("._mavro_item").val($(this).parent().find("._mavro_item").attr('data-max'));
                                    countMavro();
                                })
                                $('#' + id + " ._mavro_item").blur(function(){
                                    if(parseFloat($(this).val())>0){
                                        $(this).val(parseFloat($(this).val()).toFixed(2));
                                    }else{
                                        $(this).val(0.00);
                                    }
                                    countMavro();
                                })
                                $('#' + id + " ._mavro_item").bind('input propertychange', function(event) {
                                    if ($(this).val()=="") {
                                        $(this).val(0.00);
                                    }
                                    if($(this).attr('data-type')=='accrule_zik_model_00' && $(this).val()!=0){
                                        $(this).val($(this).attr('data-max'));
                                    }
                                    if(FloatSub($(this).attr('data-max'),$(this).val())<0){
                                        $(this).val($(this).attr('data-max'));
                                    }
                                    countMavro();
                                });
                            }
                            var tr2 = $('<tr id="draw-list"><td colspan="2" class="translate" style="border-bottom: 1px solid #666666;">'+getTranslation("rest_account")+'</td><td style="padding: 2px 15px 2px 0; border-bottom: 1px solid #666666;"><input type="hidden" id="winout_user_mavro_rest" value="'+result.pocket_money+'"/><input id="wizard_field_winout_user_mavro_rest" value="'+result.pocket_money+'" class="_money_field _rest" style="text-align:right; width: 70px; background: none; border: none;" disabled="disabled"></td><td style="border-bottom: 1px solid #666666;">&nbsp;</td></tr>');
                            tr2.appendTo('#mavro-list');
                            var tr3 = $('<tr id="draw-total"><td colspan="2" class="translate">'+getTranslation("total_out")+'</td><td colspan="2" style="text-align: right;"><input id="wizard_field_winout_user_mavro_total"  class="_money_field _total" value="0" style="font-size: 18px; height: 25px; width: 150px; background: none; border: none;" disabled="disabled">United States Dollar</td></tr>');
                            tr3.appendTo('#mavro-list');
                            $("#token_get").val(result.token_get);
                            $(".user_mavros #sellAll").click(function(){
                                $('#wizard_field_winout_user_mavro').find('._mavro_item').each(function(){
                                    $(this).val($(this).attr('data-max'));
                                })
                                countMavro();
                            })
                            var $par=$(this).parents(".window");
                            $(".wizard",$("#winout")).hide();
                            $(".wizard3",$("#winout")).show();
                            $par.css("top","152px");
                        }
                    });
                }

            }
        });
    });
    $(".wizard_pre2",$("#winout")).on("click",function(){
        var $par=$(this).parents(".window");
        $(".wizard",$("#winout")).hide();
        $(".wizard2",$("#winout")).show();
        $par.css("top","152px");
    });
    $(".wizard_next3",$("#winout")).on("click",function(){
        loadingShow();
        $f = $('#wizard_field_winout_user_mavro');
        var sum = parseFloat($f.find('#wizard_field_winout_user_mavro_total').val());
		console.log(sum);
        if(sum*100%1000==0 && sum>=10){
            loadingHide();
            $('.wizard_out_request_3_name').html($('#BitAccount').find("option:selected").text());
            $('.wizard_out_request_3_account').html(	$('#BitAccount').val());
            $('.wizard_out_request_3_total').html($('#wizard_field_winout_user_mavro_total').val());
            $('.wizard_out_request_3_remain_interest').html($('#wizard_field_winout_user_mavro_rest').val());
            var $par=$(this).parents(".window");
            $(".wizard",$("#winout")).hide();
            $(".wizard4",$("#winout")).show();
            $par.css("top","152px");
        }else if(sum*100%1000 != 0){
            loadingHide();
            showError(getTranslation('currency_multiple'));
        }else{
            loadingHide();
            showError(getTranslation('out_error_invalid_select_mavro'));
        }

    });
    $(".wizard_pre3",$("#winout")).on("click",function(){
        var $par=$(this).parents(".window");
        $(".wizard",$("#winout")).hide();
        $(".wizard3",$("#winout")).show();
        $par.css("top","152px");
    });
    $(".wizard_next4",$("#winout")).on("click",function(){
        loadingShow();
        var json = "";
        $('#wizard_row_winout_user_mavro').find('._mavro_item').each(function(){
            if(parseFloat($(this).val())>0){
                json+=$(this).attr('data-id')+":"+$(this).val()+","
            }
        })
        json+="remain_interest:"+parseFloat($f.find('#wizard_field_winout_user_mavro_rest').val());
        $.ajax({
            url:"/Home/Index/jsbzcl/",
            type: 'POST',
            dataType: 'json',
            data:{
                datas:json+"",bitAccount:$('#BitAccount').find("option:selected").attr('data-id'),
                amount:$('#wizard_field_winout_user_mavro_total').val(),
                token:$("#token_get").val()
            },
            success:function(result){
				if(result.status==-1){
                    showAlert(result.info);
                    loadingHide();
                    return;
                }
                if(result.code==2){
                    showAlert(getTranslation('transfer_not_allow_6'));
                }else if(result.code==400){
                    showAlert(getTranslation('common_saving_orders_error'));
                }else if(result.code==405){
                    showAlert(getTranslation('common_account_information_not_available'));
                }else if(result.code==305){
                    showAlert(getTranslation('bonus_to_withdraw_must_be_same_or_less'));
                }else if(result.code==306){
                    showAlert(getTranslation('you_need_to_recommit_and_pay_the_prepayment'));
                }else if(result.code==411){
                    showAlert(getTranslation('Btc_is_not_available'));
                }else if(result.code==414){
                    showAlert(getTranslation('withdraw_with_provide'));
                }else if(result.code==1){
                    ShowWindow($("#show_msg" ),288,"auto",getTranslation('Attention'));
                    var $par=$("#put_help_close").parents(".window");
                    $(".panel-tool-close",$par).off("click.winout").on("click.winout",function(){
                        var $par_=$(".wizard",$("#winout")).parents(".window");
                        $(".panel-tool-close",$par_).click();
                        location.reload();
                    })
                }
                loadingHide();
            }
        });
    });
    $(".wizard_pre21",$("#winout")).on("click",function(){
        var $par=$(this).parents(".window");
        $(".wizard",$("#winout")).hide();
        $(".wizard1",$("#winout")).show();
        $par.css("top","152px");
    });
    $(".wizard_next21",$("#winout")).on("click",function(){
        if(($("#wizard_field_winout_name").val()!="") && ($("input[name='st_number']").val()!="")&& ($("input[name='holder_firstname']").val()!="")){
            var $par=$(this).parents(".window");
            $(".wizard",$("#winout")).hide();
            $(".wizard23",$("#winout")).show();
            $par.css("top","152px");
        }else{
            $("#show_err .err_count").html(getTranslation('enter_valid_value'));
            ShowWindow($("#show_err" ),288,"auto",getTranslation('Attention'));
            $("#wizard_field_winh_sum_mavro").prop("disabled",false);
            $("#wizard_field_winh_sum_mavro2").prop("disabled",true);
        }
    });
    $(".wizard_pre22",$("#winout")).on("click",function(){
        var $par=$(this).parents(".window");
        $(".wizard",$("#winout")).hide();
        $(".wizard22",$("#winout")).show();
        $par.css("top","152px");
    });
    $(".wizard_next22",$("#winout")).on("click",function(){
        ShowWindow($("#show_msg" ),288,"auto",getTranslation('Attention'));
        var $par=$("#put_help_close").parents(".window");
        $(".panel-tool-close",$par).off("click.winout").on("click.winout",function(){
            var $par_=$(".wizard",$("#winout")).parents(".window");
            $(".panel-tool-close",$par_).click();
        })
    });
    $('[data-hint]').each(function() {
        $(this).bt('<span style="font-size: 14px !important;">' + $(this).attr('data-hint') + '</span>', {
            closeWhenOthersOpen: true,
            width: 400
        });
    });
    $("#put_help_close").on("click",function(){
        var $par=$(this).parents(".window");
        $(".panel-tool-close",$par).click();
    })
})
function countMavro(){
    var sum = 0;
    var remain_rest = parseFloat($('#wizard_field_winout_user_mavro').find('#winout_user_mavro_rest').val());
	console.log(remain_rest);
    $('#wizard_field_winout_user_mavro').find('._mavro_item').each(function(){
        if(parseFloat($(this).val())>0){
            sum= FloatAdd(sum,parseFloat($(this).val())).toFixed(2);
        }
    })
    sum =FloatAdd(remain_rest,sum).toFixed(2);
    if(sum%10 != 0){
        var m = parseInt(sum/10);
        if(m==0){
            remain_rest = sum;
        }else{
            var draw = FloatMul(m,10).toFixed(2);
            remain_rest = FloatSub(sum,draw);
        }
        sum=FloatSub(sum,remain_rest);
    }
	
    $('#wizard_field_winout_user_mavro').find('#wizard_field_winout_user_mavro_rest').val(remain_rest);
    $('#wizard_field_winout_user_mavro').find('#wizard_field_winout_user_mavro_total').val(sum);
}
function inputAll(id){
    var remain_rest = parseFloat($('#wizard_field_winout_user_mavro_rest').val());
    $('#'+id).find('._mavro_item').val($('#'+id).find('._mavro_item').attr('data-max'));
    countMavro(remain_rest);
}
//readMore
function showLeftOrderTip(order_sn){
    loadingShow();
    $fn = $('#arrange_info');
    $.ajax({
        url:"/Home/Indexnew/paintArrangementsDetails/",
        type: 'get',
        data :{order_sn:order_sn,u:selectedUserId},
        dataType: 'json',
        success:function(result){
			console.log(result.orderMesg);
            loadingHide();
            $fn.find('#order_sn').html("R"+order_sn);
            var c_type = 'BTC';
            if(result.orderMesg.currency_type==850){
                c_type = 'CNY';
            }
            var json ={"AMOUNT" : result.orderMesg.amount+" USDT ("+result.orderMesg.bit_amount+" "+c_type+" )"};
            var html=format(getTranslation('arrange_full_info1'),json);
            $fn.find('#order_amount').html(html);
            var h_name = result.orderMesg.h_name;
            if(h_name==null){
                h_name = '';
            }
            var FULLDATA = getTranslation('First Name')+'*: '+h_name+'<br>'
                +getTranslation('abbacc_acc_st_number')+'*: '+result.orderMesg.bit_account+'<br>'
                +getTranslation('addacc_bank_name')+'*: '+result.orderMesg.b_name;
            var json ={"TIME" : result.orderMesg.end_date,"FULLDATA" : FULLDATA};
            html=format(getTranslation('arrange_full_info2_receiver'),json);
            $fn.find('#sss').html(html);
            json ={"TIME" : result.orderMesg.end_date,
                "RECIVER" :result.orderMesg.getHelpName,
                "RECIVER_PHONE" : "*****",
                "Sender" :  result.orderMesg.putHelpName,
                "SENDER_PHONE" : "*****"
            };
            if(result.orderMesg.currency_type==850){
                json ={"TIME" : result.orderMesg.end_date,
                    "RECIVER" :result.orderMesg.getHelpName,
                    "RECIVER_PHONE" : result.orderMesg.getMobile,
                    "Sender" :  result.orderMesg.putHelpName,
                    "SENDER_PHONE" : result.orderMesg.putMobile
                };
            }
            html=format(getTranslation('arrange_full_info3_950_isset_gifts_2'),json);
            $fn.find('#sss2').html(html);
        }
    });
}
function handlerStatus(el,ef){
    var eo=el;
    var em=ef;
    ShowWindow($("#msg_show" ),288,"auto",getTranslation('user_unpause_order_delete_agree_text'));
    $(".btn_sure").off("click.btn_sure").on("click.btn_sure",function(){
        var face180 = $('#url_fukuan').val();
		$.ajax({
            url:"/Home/Index/home_ddxx_pcz_cl/",
            type: 'POST',
            data:{order_sn:el,face180:face180},
            success:function(result){
				if(result.code==-1){
                    showAlert(result.info);
                    loadingHide();
                    return;
                }else{
					$("#b_"+el).show();
					location.reload();
				}
            }
        });
        $(".arrg_tovover",$("#arrg_"+em)).eq(0).remove();
        var $par_=$(this).parents(".window");
        $(".panel-tool-close",$par_).click();
        $("#arrg_"+em).css({"height":"1px","display":"none"});
    })
}
$('#winap').find('a[iconcls="icon-cancel"]').on("click",function(){
    loadingShow();
    var $par=$(this).parents(".window");
    $(".panel-tool-close",$par).click();
    setTimeout(function(){
        loadingHide();
    },500)
    location.reload();
})
function handlerStatus2(el,ef){
    $("#newUpload3").empty();
    $.ajax({
        url:baselocation+"/put_help/getOrderInf/",
        type: 'get',
        data:{order_sn:el},
        dataType: 'json',
        success:function(result){
            $("#show_sure_jyAmount").html(result.order.amount);
            var c_type = 'BTC';
            if(result.order.c_type==850){
                c_type = 'CNY';
                $('.uploadPic').show();
            }else{
                $('.uploadHash').show();
            }
            $('#confirm_c_type').val(result.order.c_type);
            $("#show_sure_btcAmount").html('('+result.order.bit_amount+' '+c_type+')');
            var h_name = result.order.h_name;
            if(h_name==null){
                h_name='';
            }
            var html='<strong>'+getTranslation("First Name")+': <label>'+h_name+'</label></strong><br>'
                +getTranslation("addacc_bank_name")+': <label>'+result.order.b_name+'</label><br>'
                +getTranslation("abbacc_acc_st_number")+': <label>'+result.order.bit_account+'</label><br>'
            $("#show_sure_info").html(html);
        }
    });
    var eo=el;
    var em=ef;
    $(".wizard",$("#show_sure" )).hide();
    $(".wizard1",$("#show_sure" )).show();
    ShowWindow($("#show_sure" ),700,480,'<div class="panel-title panel-with-icon" style="">'+getTranslation('Confirm arrangment')+'</div><div class="panel-icon icon-ok"></div>');
    $(".panel-tool",$("#show_sure").parents(".window")).hide();
    $(".winap_next").off("click").on("click",function(){
        $(".wizard",$("#show_sure" )).hide();
        $(".wizard2",$("#show_sure" )).show();
    })
    $(".winap_per").off("click").on("click",function(){
        $(".wizard",$("#show_sure" )).hide();
        $(".wizard1",$("#show_sure" )).show();
    })
    //confirmsub
    $(".winap_next2").off("click").on("click",function(){
        loadingShow();
        var option = $("#wizard_field_winap_text").val();
        if($('#confirm_c_type').val()==850){
            var arrInputValues = new Array();
            $("input[name='paymsgpics']").each(function(){
                arrInputValues.push($(this).val());
            });
            var pics = "";
            for(var key in arrInputValues){
                pics +=arrInputValues[key];
                pics +=",";
            }
            if(pics.length==0){
                loadingHide();
                showError("File required");
                return false;
            }
            $.ajax({
                url:baselocation+"/put_help/payConfirm/",
                type: 'POST',
                data:{order_sn:el,option:option,hash:pics,c_type:850},
                dataType: 'json',
                success:function(result){
                    loadingHide();
                    location.reload();
                }
            });
        }else{
            var hash =$('#payHash').val();
            if(hash.length==0){
                showAlert(getTranslation('hash_required'),false);
                return;
            }
            if(!checkRate(hash)){
                showAlert(getTranslation('error_hash'),false);
                return;
            }
            $.ajax({
                url:baselocation+"/put_help/validateHash/",
                type: 'POST',
                data:{hash:hash},
                dataType: 'json',
                success:function(result){
                    if(result.code==2){
                        loadingHide();
                        showAlert(getTranslation('hash_repeat'),false);
                        return;
                    }else{
                        $.ajax({
                            url:baselocation+"/put_help/payConfirm/",
                            type: 'POST',
                            data:{order_sn:el,option:option,hash:hash,c_type:840},
                            dataType: 'json',
                            success:function(result){
                                loadingHide();
                                location.reload();
                            }
                        });
                        ShowWindow($("#show_msg" ),288,"auto",getTranslation('Warning'));
                        var $par=$("#put_help_close").parents(".window");
                        $(".panel-tool-close",$par).off("click.winout").on("click.winout",function(){
                            var $par_=$(".wizard",$("#show_sure")).parents(".window");
                            $(".panel-tool-close",$par_).click();
                            $("#arrg_"+em).css({"height":"1px","display":"none"});
                        })
                        $(".arrg_status_img",$("#arrg_"+eo)).attr("src","img/okh.png");
                    }
                }
            });
        }
    })
}
//surepayagain
function commit_payer_st1(){
    $("#show_sure_confirm_jyAmount").html($("#show_sure_jyAmount").text());
    $('#show_sure_info_again').html($('#show_sure_info').html());
    $("#show_sure_confirm_date").html($(".Wdate").val());
    $("#show_sure_confirm_option").html($("#wizard_field_winap_text").val());
}
function handlerStatus4(el,ef){
    var eo=el;
    var em=ef;
    ShowWindow($("#sure_ok" ),288,"auto",getTranslation('Release'));
    $.ajax({
        url: baselocation+'/get_help/confirmGet/token/',
        type: 'get',
        data: {order_id: el},
        success: function(result) {
            $('#confirmGet_token').val(result.confirmGet_token);
        }
    });
    $(".btn_sure",$("#sure_ok" )).off("click").on("click",function(){
        loadingShow();
        $.ajax({
            url: baselocation+'/get_help/confirmGet/',
            type: 'post',
            data: {order_id: el,token:$('#confirmGet_token').val()},
            success: function(data) {
                loadingHide();
                if (data.code==1) {
                    MESSAGE_HAPPY.hide();
                    loadArrangementsAndOrders();
                    $(".ned_close",$("#sure_ok" )).click();
//	                    if (typeof window['loadOrders'] == 'function') {
//	                        loadOrders();
//	                    }
                }else if (data.code==2) {
                    ShowWindow($("#message_happy_t" ),788,554,getTranslation('Message happy'),"#");
                    $('#mh_id_order').val(el);
                    var $par_=$("#sure_ok").parents(".window");
                    $(".panel-tool-close",$par_).click();
                    $("#arrg_"+em).css({"height":"1px","display":"none"});
                }else if (data.code==302) {
                    getTranslation('login_error_substatus_4001');
                }
            }
        });
    })
}
function handlerStatus5(el,ef){
    var eo=el;
    var em=ef;
    ShowWindow($("#sure_cancel" ),628,"auto",getTranslation('Release'));
    $(".btn_sure",$("#sure_cancel" )).off("click").on("click",function(){
        loadingShow();
        var reason = $("#wizard_field_winap_reason").val();
        var face180 = $('#url_shoukuan').val();
        var comfir_shoukuan = $('#comfir_shoukuan').val();
		$.ajax({
            url:"/Home/Index/home_ddxx_gcz_cl/",
            type: 'POST',
            data:{order_sn:el,face180:face180,comfir_shoukuan:comfir_shoukuan},
            dataType: 'json',
            success:function(result){
                loadingHide();
                location.reload();
            }
        });
        var $par_=$("#sure_cancel").parents(".window");
        $(".panel-tool-close",$par_).click();
        $("#arrg_"+em).css({"height":"1px","display":"none"});
    })
}
function preGet(){
    showError("Unknown error");
}
function writeHappyMessage(order_sn){
    ShowWindow($("#message_happy_t" ),788,554,getTranslation('Message happy'),"#");
    $('#mh_id_order').val(order_sn);
    $('#mh_type').val(1);
    event.stopPropagation();
}
function getDouble(number){
    var numbers=["0","1","2","3","4","5","6","7","8","9"];
    for(var i=0;i<numbers.length;i++){
        if(numbers[i]==number){
            return "0"+numbers[i];
        }else if(i==9){
            return number;
        }
    }
}
function uploadHash(){
    $('.pay_file .qq-upload-button').remove();
    $('.payHash').css('display','block');
}
function checkRate(nubmer)  {
    var re =  /^[0-9a-zA-Z]*$/g;
    if (!re.test(nubmer)) {
        return false;
    }else{
        return true;
    }
}
function enterCode() {
    $('#enter_code_email').show();
    $('#enter_code_email').dialog({
        width: 300,
        height: 130,
        title: getTranslation('enter_activation_code'),
        buttons: '#enter_code_email_buttons'
    });
}
function doEnterCode(type) {
    var val = $('#enter_activation_code').val();
    if (val) {
        $.ajax({
            url: baselocation+'/activation_code/doActivate',
            data: {
                'token': $('#doValidate_token').val(),
                'v': val
            },
            success: function(data) {
                if (data.code==1) {
                    showAlert(getTranslation('Active S'));
                    doClose('enter_code_email');
                }else if(data.code==0){
                    showError(getTranslation('retry_after'));
                }else if(data.code==201){
                    showError(getTranslation('Invalid token'));
                }
            }
        });
    }
}
function doClose(type) {
    $('#' + type).dialog('close');
}
function FloatAdd(arg1,arg2){
    var r1,r2,m;
    try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
    try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
    m=Math.pow(10,Math.max(r1,r2));
    return (arg1*m+arg2*m)/m;
}
function FloatSub(arg1,arg2){
    var r1,r2,m,n;
    try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
    try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
    m=Math.pow(10,Math.max(r1,r2));
    n=(r1=r2)?r1:r2;
    return ((arg1*m-arg2*m)/m).toFixed(n);
}
function FloatMul(arg1,arg2){
    var m=0,s1=arg1.toString(),s2=arg2.toString();
    try{m+=s1.split(".")[1].length}catch(e){}
    try{m+=s2.split(".")[1].length}catch(e){}
    return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m);
}
function FloatDiv(arg1,arg2){
    var t1=0,t2=0,r1,r2;
    try{t1=arg1.toString().split(".")[1].length}catch(e){}
    try{t2=arg2.toString().split(".")[1].length}catch(e){}
    with(Math){
        r1=Number(arg1.toString().replace(".",""));
        r2=Number(arg2.toString().replace(".",""));
        return (r1/r2)*pow(10,t2-t1);
    }
}
